<?php

/**
 * winbinder 패키지 
 * 
 * 
 * @package php.ui.winbinder
 */


/**
 * WBToolBar
 *
 * @package php.ui.winbinder
 */
class WBToolBar extends WBControl { 

	public function __construct($options = array()) { 
		$options['class'] = ToolBar;

		parent::__construct($options);
	}

	protected function initCreate() {
		$param = $this->getOption('param');
		
		if (isset($this->image)) { 
			$param = $this->getOption('image'); 
		}

		if (isset($this->items)) { 
			$temp = array();

			foreach ($this->getOption('items') as $item) { 
				if (is_array($item)) { 
					if ($item['tooltip']) { 
						$item['parent'] = $this;
						$tempItem = new WBToolBarItem($item);

						$temp[] = $tempItem->getToolBarTemplate();
					} else { 
						$tempItem = new WBToolBarItem(array(
							'parent'	=> $this,
							'tooltip'	=> $item[2],	
							'image'		=> $item[3],	
						));

						$temp[] = $tempItem->getToolBarTemplate();
					}
				} else { 
					$temp[] = $item;
				}
			}

			$this->setOption('caption', $temp);
		}

		$this->setOption('id', 0);
		$this->setOption('style',0);
		$this->setOption('x',0);
		$this->setOption('y',0);
		$this->setOption('width',16);
		$this->setOption('height',15);
		$this->setOption('param', $param);
	}
}

?>
